﻿using DAL;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class login : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        Session["CurrentUser"] = null;
    }
    protected void submit_id_Click(object sender, EventArgs e)
    {
        ModLogin login = new ModLogin();
        string user = "";
        string pass = "";
        user = this.login_id.Value;
        pass = this.passwd_id.Value;
        Tbl_Usuarios usuarioActual = login.login(user, pass);
        if (usuarioActual != null)
        {
            Session["CurrentUser"] = usuarioActual;//change to the user instance that'll be returned from the DB
            Response.Redirect("~/content/index.aspx");
        }
        else
        {
            this.login_id.Value = "Credenciales de Usuario no son las correctas";
        }
    }
}